package com.hncj.service;

import com.hncj.dao.PhoneMapper;
import com.hncj.pojo.Phone;
import org.springframework.stereotype.Component;

import java.util.List;


public class PhoneServiceImpl implements PhoneService {

    private PhoneMapper phoneMapper;

    //调用dao层的操作，设置一个set接口，方便Spring管理
    //set方式注入IOC容器中, 在spring-service.xml配置注入
    public void setPhoneMapper(PhoneMapper phoneMapper) {
        this.phoneMapper = phoneMapper;
    }

    public List<Phone> queryAllPhone() {
        return phoneMapper.queryAllPhone();
    }

    public int addPhone(Phone phone) {
        return phoneMapper.addPhone(phone);
    }

    public int deletePhone(int id) {
        return phoneMapper.deletePhone(id);
    }

    public int updatePhone(Phone phone) {
        return phoneMapper.updatePhone(phone);
    }

    public Phone queryPhoneById(int id) {
        return phoneMapper.queryPhoneById(id);
    }

    public List<Phone> queryPhoneByName(String phoneName) {
        return phoneMapper.queryPhoneByName(phoneName);
    }

}
